-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tasks #2
base: master
Are you sure you want to change the base?
Tasks #2
Conversation
a[p] = 1 | ||
gen_bin(a, p+1) | ||
else: | ||
outfile.write(str(''.join([str(i) for i in a])) + '\n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
str(''.join([str(i) for i in a]))
это масло масляное, ''.join([str(i) for i in a])
это уже строка.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
''.join([str(i) for i in a])
это почти тоже самое, что и ''.join((str(i) for i in a))
, что можно сократить до ''.join(str(i) for i in a)
Больше пробеловПо PEP8 нужно ставить пробелы вокруг бинарных операторов: После запятых пробелы надо ставить всегда, даже в русском языке =) Pycharm умеет делать реформат кода |
outfile = open('choose.out', 'w') | ||
|
||
n, k = [int(i) for i in infile.readline().split()] | ||
seq=range(1,n+1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seq
объявляется тут...
for line in infile.read().splitlines(): | ||
values = [int(i) for i in line.split()] | ||
dist.append(values) | ||
for i in values: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
лучше вместо цикла записать
sum += sum(i for i in values if i > 0)
где первый sum это переменная, а второй -- та самая build-in функция
В целом хорошо =)
|
No description provided.